﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CheckMarkSelection;
using DevExpress.XtraEditors;

namespace Warehouse_Management.Single
{
    public partial class listHang : DevExpress.XtraEditors.XtraForm
    {
        public listHang()
        {
            InitializeComponent();
        }
        GridCheckMarksSelection selection;
        internal GridCheckMarksSelection Selection
        {
            get
            {
                return selection;
            }
        }
        private DataTable dt = new DataTable();
        public List<PhieuGDChiTiet> listChiTiet = new List<PhieuGDChiTiet>();
        private void listHang_Load(object sender, EventArgs e)
        {
            LoadHang();
            selection = new GridCheckMarksSelection(gridView1);
            selection.CheckMarkColumn.VisibleIndex = 0;
           
        }
        private void LoadHang()
        {
            dt = Hang.SelectAll().Tables[0];
            gridControl1.DataSource = dt;
        }

        private void btnChonHang_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < Selection.SelectedCount; i++)
            {
                PhieuGDChiTiet hangGD = new PhieuGDChiTiet();
                DataRowView drv = (DataRowView)selection.GetSelectedRow(i);
                hangGD.Barcode = drv["Barcode"].ToString();
                hangGD.Ten = drv["TenHang"].ToString();
                hangGD.DVT_ID = drv["DVT_ID"].ToString();
                listChiTiet.Add(hangGD);
            }
            this.Close();
        }

    }
}